package com.tcm.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.tcm.entity.Student;
import com.tcm.entity.bo.StudentExcel;
import com.tcm.entity.dto.param.StudentPageParam;
import com.tcm.entity.dto.StudentUpdateDto;
import com.tcm.entity.vo.BatchImportResult;
import com.tcm.entity.resp.PageR;
import com.tcm.entity.vo.StudentListResult;
import com.tcm.exception.DatabaseOperationException;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author Guqier
 * @version 1.0
 * @date 2023/7/2 16:59
 */
public interface StudentService extends IService<Student> {

    @Transactional
    boolean addStudentInfo(StudentUpdateDto studentUpdateDto, Long currUserId) throws DatabaseOperationException;

    PageR<StudentListResult> getStudentListByPage(StudentPageParam studentPageParam);

    List<StudentListResult> transferStudentToListResult(List<Student> students);

    @Transactional
    boolean modifyStudentInfo(StudentUpdateDto studentUpdateDto, Long currUserId)
            throws DatabaseOperationException;

    @Transactional
    boolean removeStudentInfo(List<String> ids, Long currUserId);

    @Transactional
    BatchImportResult<StudentExcel> importStudentInfo(MultipartFile file, Long currUserId) throws IOException;


    @Transactional
    boolean confirmBatchStudentInfo(String uuid, Long currUserId);

    void exportImportFailedStudentInfo(String uuid, HttpServletResponse response) throws Exception;

    boolean exportStudentInfo(StudentPageParam studentPageParam, HttpServletResponse response);

    Student getStudentByAccount(String account);
}
